********************************************************************************
** Table 2: Balance [endline sample] (High Hopes)
********************************************************************************


set more off
clear

*load merged dataset
use "$merge_mobile", clear 

*keep only those observations where we have both baseline and endline data
keep if _merge_baseline_endline==3 

**Defining globals/variables for Panel A and B of the balance table
global respondent_varlist gender resp_primarydecisionmaker decisionmaker_male primaryormore secondaryormore formaljob spouse_formal mpesastatus  mshwari_before mobile_balance_june30

global children_varlist numberofchildreninhousehold  public_boarding schoolexpensesexpected  priorsecondaryschoolattendance financingoptions1_5



*Exporting Balance Table 2
orth_out  $respondent_varlist using "$output/Table_02_Balance.xls", ///
	by(treatment_arm) test stars se count vce(cluster schoolname_baseline_encoded) compare overall bdec(2) ///
	title(HH Panel A: Respondent) replace 

orth_out $children_varlist using "$output/Table_02_Balance.xls", vappend ///
	by(treatment_arm) test stars se count vce(cluster schoolname_baseline_encoded) compare overall bdec(2) ///
	title(HH Panel B: Children & Schooling) replace 

	 
keep permanentclassroomsusable ageofschool enrollmenttotal pupiltoteacherratio ///
		secschoolenroll treatment_arm  schoolname_baseline_encoded 
 


exit 	
Notes: Sample restricted to those with baseline and ADS consent and available at endline. Robust standard errors clustered at school level. *** significant at 1%, ** significant at 5%, * significant at 10%. Gross mobile balance is defined as total M-PESA balance plus any M-Shwari bank accounts owned.  Covariates in italics predict secondary school enrollment in a cross validated LASSO regression run on the control group only.